package com.lishe.lishe.lishe.module.excitation.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.lishe.lishe.R;
import com.lishe.lishe.lishe.MyRecyclerView.RecyclerviewBaseAdapter;
import com.lishe.lishe.lishe.module.excitation.bean.LabelObject;

import java.util.List;

/**
 * Created by shino on 2017/10/31.
 */

public class DianZanReasonAdapter extends RecyclerviewBaseAdapter {
    private List<LabelObject> labels;

    public DianZanReasonAdapter(List<LabelObject> labels) {
        this.labels = labels;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolderMy(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_dianzan_reson, null);
        DianZanReasonHolder holder = new DianZanReasonHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolderMy(RecyclerView.ViewHolder holder0, int position) {
        DianZanReasonHolder holder = (DianZanReasonHolder) holder0;
        LabelObject labelObject = labels.get(position);
        holder.lable.setText(labelObject.getActionName());
        holder.text.setText(labelObject.getActionDesc());
    }

    @Override
    public int getItemCountMy() {
        return labels == null ? 0 : labels.size();
    }

    @Override
    public int getItemViewTypeMy(int position) {
        return 0;
    }

    class DianZanReasonHolder extends RecyclerView.ViewHolder {

        TextView lable;
        TextView text;

        public DianZanReasonHolder(View itemView) {
            super(itemView);
            lable = itemView.findViewById(R.id.label);
            text = itemView.findViewById(R.id.text);
        }
    }
}
